﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AEBaseCalcCSharp
{
    abstract class Building
    {
        protected long currentCost = 0;
        protected int currentEnergy = 0;
        protected int currentArea = 0;
        protected int currentPopulation = 0;
        protected int level = 0;

        public abstract int baseCost { get; }
        public virtual int baseEnergy { get { return -1; } }
        public virtual int baseArea { get { return -1; } }
        public virtual int basePopulation { get { return -1; } }

        public virtual void incrementLevel(int newLevel)
        {
            this.level = newLevel;
            incrementCost();
            incrementEnergy();
            incrementArea();
            incrementPopulation();
        }

        public virtual void incrementLevel(int newLevel, int newFertility)
        {

        }

        //Increment Level Methods:-
        protected void incrementCost()
        {
            const double formulaConstant = 1.5;
            if (level > 0)
            {
                currentCost = Convert.ToInt64(Math.Ceiling(baseCost * (Math.Pow(formulaConstant, (level - 1)))));
            }
            else
            {
                currentCost = 0;
            }
        }

        protected void incrementEnergy()
        {
            currentEnergy = baseEnergy * level;
        }

        protected void incrementArea()
        {
            currentArea = baseArea * level;
        }

        protected void incrementPopulation()
        {
            currentPopulation = basePopulation * level;
        }

        //Getters:-
        public long getCurrentCost()
        {
            return currentCost;
        }

        public int getCurrentEnergy()
        {
            return currentEnergy;
        }

        public int getCurrentArea()
        {
            return currentArea;
        }

        public int getCurrentPopulation()
        {
            return currentPopulation;
        }
    }
}
